#include <54func.h>
int main(int argc,char *argv[])
{
    ARGS_CHECK(argc,2);
    int fd = open(argv[1],O_RDONLY);
    //ERROR_CHECK(fd,-1,"open");
    printf("fd = %d\n",fd);

    //读取
    char buf[5] = {0};
    ssize_t sret = read(fd,buf,sizeof(buf));
    ERROR_CHECK(sret,-1,"read");
    printf("sret = %ld.buf = %s\n",sret,buf);
    //每次读取之前先清空
    memset(buf,0,sizeof(buf));
    sret = read(fd,buf,sizeof(buf));
    ERROR_CHECK(sret,-1,"read");
    printf("sret = %ld.buf = %s\n",sret,buf);
    memset(buf,0,sizeof(buf));
    sret = read(fd,buf,sizeof(buf));
    ERROR_CHECK(sret,-1,"read");
    printf("sret = %ld.buf = %s\n",sret,buf);
    memset(buf,0,sizeof(buf));
    sret = read(fd,buf,sizeof(buf));
    ERROR_CHECK(sret,-1,"read");
    printf("sret = %ld.buf = %s\n",sret,buf);
    memset(buf,0,sizeof(buf));
    sret = read(fd,buf,sizeof(buf));
    ERROR_CHECK(sret,-1,"read");
    printf("sret = %ld.buf = %s\n",sret,buf);
    memset(buf,0,sizeof(buf));
    return 0;
}
